#pragma once
#include <vector>
#include <opencv2/opencv.hpp>


using polygonPoints = std::vector<cv::Point2f>;
// 定义常量PI值
const double PI = atan2(0, -1);

namespace LC_CGL_API
{
	namespace lc_geometry_mzh
	{
		polygonPoints box2Ply(cv::Rect& r);

		// 判断点是否在多边形内
		bool isPtInPolygon_m(cv::Point2f& pt, polygonPoints& ply);
		polygonPoints getInsidePoints_m(polygonPoints& ply1, polygonPoints& ply2);
		bool lineIntersection_m(cv::Point2f& pt, polygonPoints& line1, polygonPoints& line2);
		polygonPoints getBoxIntersectionPionts_m(polygonPoints& ply1, polygonPoints& ply2);
		double calcPolygonArea_m(polygonPoints& ply);
		double calcAngle_m(cv::Point2f& ptRef, cv::Point2f& pt);
		polygonPoints sortPoinsClockWise(polygonPoints& ply);
		double calcIOUObjInPolygon(polygonPoints& obj, polygonPoints& region);
		double calculateIOU(const double box1[4], const double box2[4]);
		double calcIOUObjInPolygon(cv::Rect &obj, polygonPoints& region);
	}
};

